fn main() {

	x := Abc{
		bar: MyStruct{123} // MyStruct will be converted to MySumType type automatically
	}
	
	if x.bar is MyStruct {
		// x.bar is automatically casted
		println(x.bar)
	} else if x.bar is MyStruct2 {
		new_var := x.bar as MyStruct2
		// ... or you can use `as` to create a type cast an alias manually:
		println(new_var)
	}
	
	match x.bar {
		MyStruct {
			// x.bar is automatically casted
			println(x.bar)
		}
		else {}
	}
	
	// mutable variables can change, and doing a cast would be unsafe
	// must mark the expression with the mut keyword
	mut x_2 := MySumType(MyStruct{123})
	if mut x_2 is MyStruct {
		// x_2 is casted to MyStruct even if it's mutable
		// without the mut keyword that wouldn't work
		println(x_2)
	}
	
	// same with match
	match mut x_2 {
		MyStruct {
			// x_2 is casted to MyStruct even if it's mutable
			// without the mut keyword that wouldn't work
			println(x_2)
		}
		else {}
	}
}

struct MyStruct {
	x int
}

struct MyStruct2 {
	y string
}

type MySumType = MyStruct | MyStruct2

struct Abc {
	bar MySumType
}
